<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<ul>
			<li>001</li>
			<li>002</li>
			<li>003</li>
			<li>004</li>
			<li>005</li>
		</ul>
		<script>
			//for   for循环
			
			//for in  循环可枚举属性
			
			var arr = [1,2,3,4,5];

			var obj = {
				name:'bgg',
				age:18,
				tall:180
			}
			
			for ( var k in obj ){
				console.log(k);
			}
			
			for ( var i in arr ){ //返回下标
				console.log(i);
			}
			//for of 循环可枚举的属性对应的值
			for ( var j of arr ){ //返回值
				console.log(j);
			}
			
//			console.log(length in Array.prototype);

			//Array.forEach
			console.log('===============================================================');
			//forEach和map最大区别是 map可以return修改后的数组 forEach不可以
			
			//forEach 里不可以使用 break 和 continue;
			var arr_forEach =arr.forEach(function (a){
				return a;
			});
			
			var arr_map = arr.map(function (a){
				return a;
			});
			
			
			console.log(arr_forEach);
			console.log(arr_map);
			
			var li = document.getElementsByTagName('li');
			Array.prototype.forEach.call(li,function (v,k){
				console.log(li[k].innerHTML);
			});
			
		</script>
	</body>
</html>
